<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,shrink-to-fit=no">
    <title>lagou</title>
    <!-- jquery cdn, 可换其他 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
</head>
<body>
        <input id="click" type="button" value="点击" style="color: lightseagreen" onclick="operate('点击')"/>
        <input id="collect" type="button" value="收藏" style="color: coral" onclick="operate('收藏')"/>
        <input id="send" type="button" value="投简历" style="color: darkorchid" onclick="operate('投简历')"/>
        <input id="upload" type="button" value="上传简历" style="color: deepskyblue" onclick="operate('上传简历')"/>
</body>


<script>
    function operate(action) {

        var msg = {'userId': '00001', 'actTime': current().toString(), 'action': action, 'jobCode': 'joyoung'};
        const msgStr = JSON.stringify(msg);
        $.ajax({
            url: "http://localhost:8080/send/" + msgStr,
            type: "GET",
            success: function (data) {
                if (data == "false") {
                    alert("点击失败")
                } else {
                    alert("======>点击成功");
                }
            }
        });

        function current() {
            var d = new Date(),
                str = '';
            str += d.getFullYear() + '-';
            str += d.getMonth() + 1 + '-';
            str += d.getDate() + ' ';
            str += d.getHours() + ':';
            str += d.getMinutes() + ':';
            str += d.getSeconds();
            return str;
        }
    };
</script>
</html>